<template>
  <div class="trends-box">
      <div class="label-name">
          美食搭配
      </div>
        <div class="trends">
                <div class="trends-new" v-for="(item,index) in trendlist" :key="index">
                    <div class="trends-item">
                        <div class="trends-top">
                            <div> <a :href="vhref+item.fmId">{{item.fmtitle}}</a></div>
                            <div>{{item.fmDate}}</div>
                            <div class="trends-text" v-html="item.fmContent"></div>
                        </div>
                        <div class="trends-line">
                                <div></div>
                        </div>
                        <div class="trends-bottom">
                            <div>
                                <a href="/collocaitem"><img src="../../assets/img/youjt.svg" alt=""></a> 
                            </div>
                        </div>
                    </div>
                    <div class="trdnds-img"> 
                        <img :src="item.fmImg" alt="">
                    </div>
                </div>
                
        </div>
  </div>
</template>

<script>
import { request } from "../../network/request";

export default {
    name:'Trends',
    data() {
        return {
            trendlist:'',
            vhref:'/vcollocationitem?fmId='
        }
    },
    created() {
        request({
            url: "/firstpage/queryFoodMatchingRanking",
            })
            .then((res) => {
              this.trendlist = res.data.data
              console.log(res);
            })
            .catch((err) => {
                console.log(err);
            });
    },
}
</script>

<style>
.trends-box{
    width: 85%;
    margin: 0 auto;
    margin-top: 0.4rem;
}

.trends{
    display: flex;
    width: 100%;
    margin: 0 auto;
    justify-content: space-between;
    padding-bottom: 1rem;
}

.trends-new{
    width: 2rem;
    height:1.7rem;
    margin-top: 0.25rem;
}

.trends-item{
    position: relative;
    z-index: 99;
    width: 2rem;
    height:1.7rem;
    background-color: rgb(145, 184, 218);
    color: rgb(236, 247, 247);
    overflow: hidden;
}

.trends-item a{
    text-decoration: none;
    color: rgb(236, 247, 247);
}

.trends-top{
    width: 100%;
    height: 1.8rem;
}

.trends-top :nth-child(1){
    width: 75%;
    margin: 0 auto;
    padding-top: 0.15rem;
    font-size: 0.14rem;
    overflow:hidden;
	white-space:nowrap;
	text-overflow: ellipsis;
    transition: all 0.5s;
}

.trends-top :nth-child(2){
    width: 75%;
    margin: 0 auto;
    margin-top: 0.05rem;
    font-size: 0.1rem;
}

.trends-line{
    width: 80%;
    height: 2px;
    border-radius: 2px;
    margin: 0 auto;
    background-color: rgb(90, 90, 90);
    margin-top: -0.4rem;
}

.trends-line div{
    width: 0;
    height: 2px;
    border-radius: 2px;
    background-color: rgb(255, 255, 255);
    position:relative;
    margin-left: 0.003rem;
    transition: all 0.5s;
}

.trends-bottom{
    font-size: 0.16rem;
    margin-top: 0.1rem;
}

.trends-bottom div{
    width: 0.22rem;
    height: 0.22rem;
    line-height: 0.2rem;
    background-color: rgb(74, 94, 94);
    text-align: center;
    position: relative;
    left: 2rem;
    transition: all 1s;
    bottom: 0.06rem;
}

.trends-bottom div img{
    width: 0.19rem;
    height: 0.19rem;
}

.trends-item:hover .trends-line div{
    width: 1.6rem;
}

.trends-item:hover .trends-bottom div{
    left: 1.6rem;
}

.trends-item:hover .trends-top{
    color: rgb(255, 255, 255);
}

.trends-item:hover .trends-top :nth-child(1){
    /* margin-top: 0.2rem; */
    padding-top: 0.3rem;
    color: rgb(255, 255, 255);
}


.trends-item:hover{
    background-color: rgba(200, 11, 11, 0);
}

/* .trends-item:hover +.trdnds-img img{
    transform:scale(1.5);
    transition: all 0.5s;
} */


.trdnds-img{
    position: relative;
    width: 2rem;
    height:1.7rem;
    overflow: hidden;
    z-index: 9;
    top: -1.7rem;
}

.trdnds-img img{
    width:100%;
    height:100%;
}

.huan {
  display: flex;
  width: 100%;
  height: 0.5rem;
  text-align: left;
  line-height: 0.5rem;
  align-items: center;

}
.huan img {
  width: 0.4rem;
  height: 0.4rem;
  transition: 1s all;
  margin-left: 0.5rem;
}

.huan span {
  display: inline-block;
  width: 1rem;
  font-size: 0.2rem;
}

.huan a{
  text-decoration: none;
  color: black;
}

.huan:hover {
  cursor: pointer;
}

.huan:hover img {
  transform: rotate(360deg);
}

.trends-text{
    width: 75%;
    margin: 0 auto;
    margin-top: 0.08rem;
    font-size: 0.1rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
}

</style>